from common import AlbumEntity, ArtistEntity, SearchFilter, ParameterEntity, utility
from dataaccess import AlbumData, ArtistData, ParameterData
import urllib
import json

def new_album():
    all_artist_entities = ArtistData.ArtistData().SelectAllArtists()
    artists = []

    for artist_entity in all_artist_entities:
        artists.append(artist_entity.Name)

    sf = SearchFilter.SimpleFilter(ParameterEntity.ParameterEntity.ColumnNames.paramType, SearchFilter.ConditionType.Equal, utility.ParameterGroup.Genre)
    genreRows = ParameterData.ParameterData().SelectParameterByFilter(sf)
    genres = {}
    for parameterEntity in genreRows:
        genres[parameterEntity.ParamID] = parameterEntity.ParamName
        
    return dict(genres=genres,artists=artists)


